package org.luxor.commons.workflow.entity;

import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;

/**
 * 流程定义-查询参数
 *
 * @author Mr.yan  @date 2021/10/16
 */
public class ProcessDefinitionQuery {

    /**
     * 租户ID
     */
    private String tenantId;

    /**
     * 分类
     */
    private String category;

    /**
     * 激活
     */
    private boolean active;

    /**
     * 流程名称(LIKE)
     */
    private String name;

    /**
     * 流程编码(LIKE)
     */
    private String key;

    /**
     * 部署ID集合
     */
    private Set<String> deploymentIds;

    public ProcessDefinitionQuery() {
        this.deploymentIds = new HashSet<>();
    }

    public String getTenantId() {
        return tenantId;
    }

    public void setTenantId(String tenantId) {
        this.tenantId = tenantId;
    }

    public String getCategory() {
        return category;
    }

    public void setCategory(String category) {
        this.category = category;
    }

    public boolean isActive() {
        return active;
    }

    public void setActive(boolean active) {
        this.active = active;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    public Set<String> getDeploymentIds() {
        return deploymentIds;
    }

    public void setDeploymentIds(Set<String> deploymentIds) {
        this.deploymentIds = deploymentIds;
    }

    public void addDeploymentId(String deploymentId) {
        this.deploymentIds.add(deploymentId);
    }

    public void removeDeploymentId(String deploymentId) {
        this.deploymentIds.remove(deploymentId);
    }

    @Override
    public String toString() {
        return "ResourceQuery{" +
                "tenantId='" + tenantId + '\'' +
                ", category='" + category + '\'' +
                ", active=" + active +
                ", name='" + name + '\'' +
                ", key='" + key + '\'' +
                ", deploymentIds=" + Arrays.toString(deploymentIds.toArray()) +
                '}';
    }
}
